package cate.game.role.pvp.teampvp.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTeamPvp;
import lombok.extern.slf4j.Slf4j;

@ClientMsg(title = "组队竞技数据请求")
@Slf4j
public class TeamPvpDataReq implements MsgInput {
    @Override
    public void execute(GameBody game, ClientContext cc) {
        int rank = cc.getRole().getPvp().pointRace.getRank();
        if (rank < 0 || rank > 99) {
            game.notice.message(cc.getRole(), "竞技场排名前100才可参与");
            return;
        }
        try{
            cc.sendNow(new TeamPvpDataResp(cc.getRole()));
        } catch (Exception e) {
            log.error("连不上group啊，e=",e);
            game.notice.message(cc.getRole(), "哎呀，服务器出问题拉");
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTeamPvp.DATA_REQ;
    }
}
